<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>实名插槽slot</title>
    <script src="vue.js"></script>
</head>

<body>
    <div id="app">
        <my-computer>
            <div slot="cpu" style="width:100px; height:100px; background:skyblue;">inter core i5</div>
            <div slot="hard-disk" style="width:100px; height:100px; border-radius:50%; background:tan;">hard-disk</div>
            <div slot="memory"> memory </div>
            <img slot="graphics-card" src="../../images/7.jpg" alt="">
        </my-computer>
    </div>

    <!-- template -->
    <template id="my_computer">
        <div id="main">
            <slot name="cpu">这是插CPU的</slot>
            <slot name="hard-disk">这是插硬盘的</slot>
            <slot name="memory">这是插内存的</slot>
            <slot name="graphics-card">这是插显卡的</slot>
        </div>
    </template>

    <!-- js -->
    <script>
        new Vue({
            el: '#app',
            components: {
                "my-computer": {
                    template: "#my_computer"
                }
            }
        });
    </script>
</body>

</html>